package com.yunkaweilai.android.view.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.yunkaweilai.android.R;
import com.yunkaweilai.android.constants.Api;
import com.yunkaweilai.android.interfaces.MyDialogInterface;
import com.yunkaweilai.android.interfaces.ScoreClearInterface;
import com.yunkaweilai.android.interfaces.StringInterface;
import com.yunkaweilai.android.net.HttpRequest;
import com.yunkaweilai.android.net.PostProcess;
import com.yunkaweilai.android.utils.Utils;
import com.yunkaweilai.android.view.MyToast;


/**
 * 积分清零 dialog
 * Created by K on 2019/07/15
 */

public class ScoreClearDialog extends Dialog {
    private TextView id_tv_max_type;
    private TextView idTvContent;
    private TextView idTvRight;
    private TextView idTvClose;
    private EditText idET;
    private String title;
    private String content;
    private String member_id;
    private String SET_REST_SCORE;
    private Context mContext;
    private ScoreClearInterface mScoreClearInterface;

    public ScoreClearDialog(@NonNull Context context, String title, String content, ScoreClearInterface ScoreClearInterface) {
        super(context, R.style.dialog);
        this.mContext = context;
        this.title = title;
        this.mScoreClearInterface = ScoreClearInterface;
        this.content = content;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_points_clear);
        id_tv_max_type = ((TextView) findViewById(R.id.id_tv_max_type));
        id_tv_max_type.setText(title);
        idTvContent = ((TextView) findViewById(R.id.id_tv_content));
        idTvContent.setText(content);
        idET = (EditText) findViewById(R.id.score_clear_dialog_et);
        idTvRight = ((TextView) findViewById(R.id.id_tv_right));
        idTvRight.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (idET.getText().toString().isEmpty()) {
                    MyToast.showShortToast(mContext, "请填写备注");
                } else {
                    mScoreClearInterface.clear(idET.getText().toString());
                    dismiss();
                }
            }
        });
        idTvClose = ((TextView) findViewById(R.id.id_tv_close));
        idTvClose.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });

    }


}
